package cz.proks.easyhelpdesk.api;

import cz.proks.easyhelpdesk.api.exception.ApiException;
import cz.proks.easyhelpdesk.api.model.base.AnIdentifiableModel;

/** Base universal interface for application entities */
public interface BaseApi <Entity extends AnIdentifiableModel> {	
	/**
	 * Retrieves an entity
	 * @param id - Entity indetifier
	 * @return Entity instance if found or null
	 * @throws ApiException
	 */
	Entity get(Long id) throws ApiException;	
	
	/**
	 * Creates an entity
	 * @param entity - Entity to create
	 * @return Created entity
	 * @throws ApiException
	 */
	Long create(Entity entity) throws ApiException;
	
	/**
	 * Updates an entity
	 * @param entity - Entity with new values to update
	 * @return Updated entity
	 * @throws ApiException
	 */
	void update(Entity entity) throws ApiException;	
	
	/**
	 * Deletes an entity
	 * @param id - Entity identifier to delete it
	 * @return Deleted entity
	 * @throws ApiException
	 */
	void remove(Long id) throws ApiException;
}
